var sysPath = "";

function SetSysPath(path){
	sysPath = path;
}

function AddMainTab(id,node_text,node_icon, tabs) {
	var tab = tabs.getItem(id);

	if (tab == null) {
		var _title = node_text;
		var _icon = node_icon;
		var _item = "";
		if (id == "20000001") {
			_item = GetCount();
		} else if (id == "20000004") {
			_item = GetInfo();
		} else if (id == "30000001") {
			_item = GetUser();
		} else if (id == "20000000") {
			_item = GetNettopo();
		} else if (id == "50000111") {
			_item = GetDashboard();
		} else if (id == "5000011a") {
			_item = GetDashboard();
		} else if (id == "50001011" || id == "50002011" || id == "50003011") {
			_item = GetRouting();
		} else if (id == "50002001" || id == "50001001" || id == "50003001") {
			_item = GetFirewallConfig();
		} else if (id == "50001021" || id == "50002021" || id == "50003021") {
			_item = GetNetworkGroups();
		} else if (id == "50001022" || id == "50002022" || id == "50003022") {
			_item = GetServiceGroups();
		} else if (id == "50001023" || id == "50002023" || id == "50003023") {
			_item = GetDateStep();
		} else if (id == "50001031" || id == "50002031" || id == "50003031") {
			_item = GetRunMonitor();
		} else if (id == "50001032" || id == "50002032" || id == "50003032") {
			_item = SystemConfig();
		} else if (id == "50001033" || id == "50002033" || id == "50003033") {
			_item = GetOptimize();
		} else if (id == "50001034" || id == "50002034" || id == "50003034") {
			_item = GetTestBaseSub();
		} else if (id == "50001041" || id == "50002041" || id == "50003041") {
			_item = GetNowFlow();
		} else if (id == "50001151" || id == "50002151" || id == "50003151") {
			_item = GetRAVpnConfig();
		} else if (id == "50001152" || id == "50002152" || id == "50003152") {
			_item = GetRAVpnLink();
		} else if (id == "50001251" || id == "50002251" || id == "50003251") {
			_item = GetStsVpnConfig();
		} else if (id == "50001252" || id == "50002252" || id == "50003252") {
			_item = GetStsVpnLink();
		} else if (id == "50001062" || id == "50002062" || id == "50003062") {
			_item = GetNAT_Now();
		} else if (id == "50001063" || id == "50002063" || id == "50003063") {
			_item = GetFlowReport();
		
		} else if (id == "50001073" || id == "50002073" || id == "50003073") {
			_item = GetOptimize();
		} else if (id == "50000013" || id == "20000002") {
			_item = GetACLApply();
		} else if (id == "90000009" ) {
			_item = GetACLApply1();
		} else if (id == "90000010" ) {
			_item = GetACLApply2();
		} else if (id == "90000011" ) {
			_item = GetACLApply3();
		} else if (id == "90000012" ) {
			_item = GetACLApply4();
		} else if (id == "50000011" ) {
			_item = GetACLBaseSet();
		} else if (id == "50001073" || id == "50002073" || id == "50003073") {
			_item = GetACLBase();
		} else if (id == "50001074" || id == "50002074" || id == "50003074") {
			_item = GetAccessRules();
		} else if (id == "50001008" || id == "50002008" || id == "50003008") {
			_item = GetBasicinfo();
		} else if (id == "50001009" || id == "50002009" || id == "50003009") {
			_item = GetLonglink();
		} else if (id == "50001111" || id == "50002111" || id == "50003111") {
			_item = GetTracking();
		} else if (id == "50001012" || id == "50002012" || id == "50003012") {
			_item = GetCaught();
		} else if (id == "50001013" || id == "50002013" || id == "50003013") {
			_item = GetPing();
		} else if (id == "60001001") {
			_item = GetSystemWarn();
		} else if (id == "60001002") {
			_item = GetFlowWarn();
		} else if (id == "60001003") {
			_item = GetApplyWarn();
		} else if (id == "60001004") {
			_item = GetApplyVolumeWarn();
		} else if (id == "60001005") {
			_item = GetViolationWarn();
		} else if (id == "50004001") {
			_item = GetSNMP_Log();
		} else if (id == "50004002") {
			_item = GetFlow_Log();
		} else if (id == "50004003") {
			_item = GetVPN_Log();
		} else if (id == "50004004") {
			_item = GetNAT_Log();
		} else if (id == "50004005") {
			_item = GetACL_Log();
		} else if (id == "60000003") {
			_item = GetSys_Log();
		} else if (id == "60000004") {
			_item = ClearLog();
		} else if (id == "60000005") {
			_item = GetUpdate();
		} else if (id == "60000006") {
			_item = GetSysInfo();
		} else if (id == "60000007") {
			_item = GetHandbook();
		} else if (id == "10002001") {
			_item = GetFlow_Count();
		} else if (id == "10002002") {
			_item = GetFlowReportChar();
		} else if (id == "10002003") {
			_item = GetFlowReportPie();
		} else if (id == "10002004") {
			_item = GetFlow_Subscribe();
		} else if (id == "10001001") {
			_item = GetVPN_Count();
		} else if (id == "10001002") {
			_item = GetVPNReportChar();
		} else if (id == "10001003") {
			_item = GetVPNReportList();
		} else if (id == "10001004") {
			_item = GetVPN_Subscribe();
		} else if (id == "10003001") {
			_item = GetNAT_Count();
		} else if (id == "10003002") {
			_item = GetNATReportChar();
		} else if (id == "10003003") {
			_item = GetNATReportPie();
		} else if (id == "10003004") {
			_item = GetNAT_Subscribe();
		} else if (id == "10004001") {
			_item = GetACL_Count();
		} else if (id == "10004002") {
			_item = GetACLReportChar();
		} else if (id == "10004003") {
			_item = GetACLReportList();
		} else if (id == "10004004") {
			_item = GetACLReportPie();
		} else if (id == "10004005") {
			_item = GetACL_Subscribe();
		} else if (id == "70000001") {
			_item = GetDepartment();
		} else if (id == "70000002") {
			_item = GetManager();
		} else if (id == "70000003") {
			_item = GetSubnet();
		} else if (id == "70000004") {
			_item = GetApplication();
		} else if (id == "70000005") {
			_item = GetDeviceinfo();
		} else if (id == "10000011") {
			_item = GetISO27001();
		} else if (id == "10000012") {
			_item = GetPCI_DSS();
		} else if (id == "10000013") {
			_item = GetDengbao();
		} else if (id == "10000020") {
			_item = GetApplyReportNowChar();
		} else if (id == "10000080") {
			_item = GetApplyChanageNowChar();
		} else if (id == "10000030") {
			_item = GetHazardReportNowChar();
		} else if (id == "10000040") {
			_item = GetACLReportNowChar();
		} else if (id == "10000050") {
			_item = GetVPNReportNowChar();
		} else if (id == "10000060") {
			_item = GetNATReportNowChar();
		} else if (id == "10000070") {
			_item = GetFlowReportNowChar();
		} else if (id == "80010001") {
			_item = GetDeviceBase();
		} else if (id == "80010002") {
			_item = GetACLBase();
		} else if (id == "80020001") {
			_item = GetDeviceBaseTest();
		} else if (id == "80020002") {
			_item = GetTestBase();
		} else if (id == "90010001") {
			_item = GetAnalyze_Policy_Exit();
		} else if (id == "90010002") {
			_item = GetAnalyze_Policy_Optimize();
		} else if (id == "90000002") {
			_item = GetAnalyze_Application();
		} else if (id == "90000005") {
			_item = GetAnalyze_Application1();
		} else if (id == "90000003") {
			_item = GetAnalyze_Policy_Other();
		} else if (id == "a0000002") {
			_item = GetAccessRules1();
		} else if (
			id == "60000011" ||
			id == "60000012" ||
			id == "60000013" ||
			id == "60000014" ||
			id == "60000015" ||
			id == "60000016" ||
			id == "60000017" ||
			id == "60000018" ||
			id == "60000019" ||
			id == "60000020" 
			) {
			_item = GetSMP(id);
		}else{
				
				return ;
		}

		var tab = tabs.add({
					id : id,
					title : _title,
					iconCls : _icon,
					items : [_item],
					layout : 'fit',
					border : false,
					split : true,
					autoScroll : true,
					closable : true,
			        listeners : {   
				        "destroy" : function(){   
				            if(tabs.items.length == 0){
				            	//AddMainTab("20000001","仪表盘","flag", tabs);
				            } 
				        }
				    }
				}).show();
	} else {
		tabs.setActiveTab(tab);
	}

}
function ModifyPassword() {
	var manager = new Ext.form.FormPanel({
				frame : true,
				layout : 'form',
				region : 'center',
				xtype : 'fieldset',
				bodyStyle : 'padding:10px;',
				items : [{
							xtype : 'textfield',
							name : 'manager.id',
							fieldLabel : '',
							anchor : '100%',
							hidden : true,
							hideLabel : true
						}, {
							xtype : 'textfield',
							name : 'manager.name',
							fieldLabel : '名称',
							readOnly : true,
							anchor : '100%'
						}, {
							xtype : 'textarea',
							name : 'manager.context',
							fieldLabel : '描述',
							readOnly : true,
							anchor : '100%'
						}, {
							xtype : 'textfield',
							name : 'manager.password',
							fieldLabel : '密码',
							inputType : 'password',
							anchor : '100%'
						}, {
							xtype : 'textfield',
							name : 'repassword',
							fieldLabel : '确认密码',
							inputType : 'password',
							anchor : '100%'
						}]

			});

	var title = "";
	var caption = "";
	title = "修改密码";
	caption = "修改密码";

	var mwindow = new Ext.Window({
				layout : 'border',
				width : 400,
				height : 250,
				title : title,
				modal : true,
				resizable : true,
				maximizable : true,
				iconCls : 'modifypwd',
				items : [manager],
				plain : true
			});
	mwindow.addButton({
				text : caption,
				handler : function() {
					mwindow.close();
				}
			});
	mwindow.addButton({
				text : '取 消',
				handler : function() {
					mwindow.close();
				}
			});
	mwindow.show();
}
function ModifyFilter() {
	var manager = new Ext.form.FormPanel({
				frame : true,
				layout : 'form',
				region : 'center',
				xtype : 'fieldset',
				bodyStyle : 'padding:10px;',
				items : [
						new Ext.form.CompositeField({ 
										    fieldLabel: '厂商', 
										    items: [ 
										    		
										    		{ 
										            xtype: 'checkbox',
										            boxLabel:'启用'
														}, new Ext.form.TextField({ 
																	    name: 'my_field',
																	    value:'',
																	    flex: 1 
														})
										         
										    ] 
						}),new Ext.form.CompositeField({ 
										    fieldLabel: '应用系统', 
										    items: [ 
										    		
										    		{ 
										            xtype: 'checkbox',
										            boxLabel:'启用'
														}, new Ext.form.TextField({ 
																	    name: 'my_field',
																	    value:'',
																	    flex: 1 
														})
										         
										    ] 
						}),new Ext.form.CompositeField({ 
										    fieldLabel: '物理或虚拟', 
										    items: [ 
										    		
										    		{ 
										            xtype: 'checkbox',
										            boxLabel:'启用'
														}, new Ext.form.TextField({ 
																	    name: 'my_field',
																	    value:'',
																	    flex: 1 
														})
										         
										    ] 
						}),new Ext.form.CompositeField({ 
										    fieldLabel: '管理IP', 
										    items: [ 
										    		
										    		{ 
										            xtype: 'checkbox',
										            boxLabel:'启用'
														}, new Ext.form.TextField({ 
																	    name: 'my_field',
																	    value:'',
																	    flex: 1 
														})
										         
										    ] 
						}),new Ext.form.CompositeField({ 
										    fieldLabel: '防火墙', 
										    items: [ 
										    		
										    		{ 
										            xtype: 'checkbox',
										            boxLabel:'启用'
														}, new Ext.form.TextField({ 
																	    name: 'my_field',
																	    value:'',
																	    flex: 1 
														})
										         
										    ] 
						})]

			});

	var title = "";
	var caption = "";
	title = "设备显示过滤";
	caption = "设置";

	var mwindow = new Ext.Window({
				layout : 'border',
				width : 400,
				height : 250,
				title : title,
				modal : true,
				resizable : true,
				maximizable : true,
				iconCls : 'filter',
				items : [manager],
				plain : true
			});
	mwindow.addButton({
				text : caption,
				handler : function() {
					mwindow.close();
				}
			});
	mwindow.addButton({
				text : '取 消',
				handler : function() {
					mwindow.close();
				}
			});
	mwindow.show();
}

function LogoutSystem(){
	window.location.href = 'index.html';
}

function ShowMsgTip(){
			var window = new Ext.Window({
						width : 390,
						height : 200,
						shadow : false,
						html : "欢迎登陆SEM",
						title : "温馨提示:"
					});
			function show() {
				this.el.alignTo(Ext.getBody(), 'br-br');
				this.el.slideIn('b', {
							easing : 'easeOut',
							callback : function() {
								this.close.defer(10000, this); //定时关闭窗口
							},
							scope : this,
							duration : 1
						});

			}
			function hide() {
				if (this.isClose === true) { //防止点击关闭和定时关闭处理
					return false;
				}
				this.isClose = true;
				this.el.slideOut('b', {
							easing : 'easeOut',
							callback : function() {
								this.un('beforeclose', hide, this);
								this.close();
							},
							scope : this,
							duration : 5
						});
				return false;
			}
			window.on('show', show, window);
			window.on('beforeclose', hide, window)
			window.show();
}